<script lang="ts">
import Vue from 'vue'
import {getDataSummary, exportDataCsv} from '@/api/systemTools'

export default Vue.extend({
  name: "step4",
  props: {
    redisKey: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      tableData: [],
      loading: false
    }
  },
  methods: {
    dataSummary() {
      this.loading = true
      getDataSummary({redisKey: this.redisKey}).then(res => {
        this.tableData = res
      }).finally(() => {
        this.loading = false
      })
    },
    exportData() {
      exportDataCsv({redisKey: this.redisKey})
    }
  },
  created() {
    this.dataSummary()
  },
})
</script>

<template>
  <div>
    <div>
      <el-button type="primary" @click="$emit('prev')">上一步</el-button>
      <el-button @click="exportData">导出数据</el-button>
    </div>
    <el-table
      v-loading="loading"
      :data="tableData"
      border
      style="width: 100%;margin-top: 15px"
    >

      <el-table-column
        prop="coachName"
        label="教练名字"
        min-width="120"
      />

      <el-table-column
        prop="vocabularyHours"
        label="词汇课课时"
        min-width="120"
      />

      <el-table-column
        prop="experienceHours"
        label="体验课课时"
        min-width="120"
      />

      <el-table-column
        prop="readingGrammarListeningWritingHours"
        label="阅读完型语法听力写作"
        min-width="180"
      />

      <el-table-column
        prop="dealBonus"
        label="成交奖励"
        min-width="120"
      />

      <el-table-column
        prop="bonus"
        label="奖金"
        min-width="100"
      />

      <el-table-column
        prop="deduction"
        label="扣除/惩罚"
        min-width="100"
      />

      <el-table-column
        prop="referralBonus"
        label="推荐奖"
        min-width="100"
      />

      <el-table-column
        prop="payableCommission"
        label="应发放佣金"
        min-width="120"
      />

    </el-table>
  </div>
</template>

<style scoped lang="scss">

</style>
